/*
	FileName : app_led.h
	Description : 
	
	Created on 2013.10.27 by ZZP.
	
	Revision History:
	
*/

/* 
 * LED definition.
 * STM: Status of ZJB.
 * 		0.250s(on)/1.750s(off)	both normal.
 *		0.125s(on)/0.875s(off)	one or two error.
 * COM: Communication of TAX.
 * 		0.125s(on)/0.875s(off)	communication normal.
 * 		constant on				communication error.
 * CFC: Status of storage card
 *		0.025s(on)/0.025s(off)	operating
 *		0.025s(on)/1.975s(off)	idle
 *		3.975s(on)/0.025s(off)	error
 * USB: Status of USB
 *		0.025s(on)/0.025s(off)	operating
 *		0.025s(on)/1.975s(off)	idle
 *		3.975s(on)/0.025s(off)	error
 *		constant off			undetected
 * ERR: Status of JLB
 *		constant off			normal
 *		0.025s(on)/0.025s(off)	RTC error
 *		0.125s(on)/0.375s(off)	storage card error
 *		0.025s(on)/1.975s(off)	EEPROM error
 *		0.025s(on)/0.025s(off)(flash with STM) warning: overheating (>85)
 * CAN: Status of CAN communication
 * 		0.125s(on)/0.375s(off)	both normal
 *		0.125s(on)/0.875s(off)	CANA error
 *		0.875s(on)/0.125s(off)	CANB error
 *		3.975s(on)/0.025s(off)	both error
 * BTM: reserved
 *		constant off
 * DTU: Communication of Remote Monitor
 * 		0.075s(on)/0.075s(off)	login
 *		0.650s(on)/0.650s(off)	register
 *		0.075s(on)/2.575s(off)	communicating
 *		constant off			undetected
 */
#ifndef __APP_LED_H__
#define __APP_LED_H__

#include "stdint.h"

//----------------------------------------------------------------------------------------

///WORK LED Status
#define WORK_LED_STATUS_NORMAL		0
#define WORK_LED_STATUS_ERROR		1

///COPY LED Status
#define COPY_LED_STATUS_NORMAL			0
#define COPY_LED_STATUS_USB				2
#define COPY_LED_STATUS_CF_ERROR		3
#define COPY_LED_STATUS_START_SIGNAL	4
#define COPY_LED_STATUS_FORMAT			5
#define COPY_LED_STATUS_USB_ERROR		6
#define COPY_LED_STATUS_USB_PROTECTED	7

///ERROR LED Status
#define ERROR_LED_STATUS_NORMAL			0
#define ERROR_LED_STATUS_RTC			1
#define ERROR_LED_STATUS_COM			2
#define ERROR_LED_STATUS_COIL			3
#define ERROR_LED_STATUS_HX				4
#define ERROR_LED_STATUS_CF				0x10
#define ERROR_LED_STATUS_COIL_2			0x11
#define ERROR_LED_STATUS_RTC_2			0x12
#define ERROR_LED_STATUS_BD_8LED		0x13
#define ERROR_LED_STATUS_SAMPLE_CPU		0x14

//----------------------------------------------------------------------------------------

typedef struct{
	
	//----------CFC--------------
	uint16_t	CFCFlashCnt;
	uint8_t		CFCLedFlag;
	uint8_t		CFCSDFlag;
	//----------ERR--------------
	uint8_t		ERRRTCFlag;
	uint8_t		ERRCOMFlag;
	uint8_t		ERRLedFlag;	
	//----------STM--------------
	uint8_t		STMLedFlag;
	//----------USB--------------
	uint8_t		USBLedFlag;
	//----------USB--------------
	uint8_t		DTULedFlag;
	uint8_t		DTUFlashCnt;
	//---------------------------
	
}APP_LED_STR, *pAPP_LED_STR;

extern APP_LED_STR JLB_M_led;
//---------------------------------------------------------------------------------------
void AppTaskLED(void *p_arg);

void ErrLedFlagUpdate(uint8_t coilerr,uint8_t rtcValid,uint8_t ctrlValid,uint32_t powerOnTime);


//----------------------------------------------------------------------------------------
#endif///EOF




